package src.main.java.org.collection.collections;


import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        List<String> names = new ArrayList<>();
        Collections.addAll(names,"张三","李四","王五"); //批量添加数据
        System.out.println(names);

        Collections.shuffle(names);//打乱顺序
        System.out.println(names);

        List<Integer> num = new ArrayList<>();
        num.add(1);
        num.add(20);
        num.add(10);
        Collections.sort(num);
        System.out.println(num);

        List<Student> students = new ArrayList<>();
        students.add(new Student("张三",23,187));
        students.add(new Student("李四",22,184));
        students.add(new Student("王五",24,181));
        students.add(new Student("赵六",21,188));
        Collections.sort(students); //也要实现comparable接口
        System.out.println(students);
    }
}
